[Google Maps] Trouble with invalid argument when switching jQueryUI based tabs

Posted by Chad on Stack Overflow See other posts from Stack Overflow or by Chad
Published on 2010-03-12T10:43:53Z Indexed on 2010/03/12 10:47 UTC
Read the original article Hit count: 385

Here's a page with the issue

To reproduce the error, using IE - click the directions tab, then any of the others.

What I'm trying to do is this:

On page load, do nothing really. However, when the directions tab loads - setup the map. Like so:

$('#tabs').bind('tabsshow', function(event, ui) {
    if (ui.panel.id == "tabs-5") {

        // get map for directions
        var dirMap = new GMap2($("div#dirMap").get(0));
        dirMap.setCenter(new GLatLng(35.79648921414565,139.40663874149323), 12);
        dirMap.enableScrollWheelZoom();
        dirMap.addControl(new PanoMapTypeControl());
        geocoder = new GClientGeocoder();

        $("#dirMap").resizable({
           stop: function() { dirMap.checkResize(); }
        });
        // clear dirText
        $("div#dirMapText").html("");
        dirMap.clearOverlays();

        var polygon = new GPolygon([new GLatLng(35.724496338474104,139.3444061279297),new GLatLng(35.74748750802863,139.3363380432129),new GLatLng(35.75765724051559,139.34303283691406),new GLatLng(35.76545779822543,139.3418312072754),new GLatLng(35.767547103447725,139.3476676940918),new GLatLng(35.75835374997911,139.34955596923828),new GLatLng(35.755149755962755,139.3567657470703),new GLatLng(35.74679090345495,139.35796737670898),new GLatLng(35.74762682821177,139.36294555664062),new GLatLng(35.744422402303826,139.36346054077148),new GLatLng(35.74860206266584,139.36946868896484),new GLatLng(35.735644401200986,139.36843872070312),new GLatLng(35.73843117306677,139.36174392700195),new GLatLng(35.73592308277646,139.3531608581543),new GLatLng(35.72686543236113,139.35298919677734),new GLatLng(35.724496338474104,139.3444061279297)], "#f33f00", 5, 1, "#ff0000", 0.2);dirMap.addOverlay(polygon);

        // load directions
        directions = new GDirections(dirMap, $("div#dirMapText").get(0));
        directions.load("from: [email protected],139.37083393335342 to: Ruby [email protected],139.40663874149323");

    }
});

What the heck is causing the error? The IE javascript debugger claims the error lies in main.js, line 139 character 28. (the google maps api file). Which is this line:

function zf(a,b){a=a.style;a.width=b.getWidthString();a.height=b.getHeightString()}

Any ideas? Thanks in advance!

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about google-maps